 
/* 
 * Copyright (C) Ignacio Lucas
 */
 
#ifndef MASHUP_SERVER_CONF_FILE_H_INCLUDED
#define MASHUP_SERVER_CONF_FILE_H_INCLUDED


#include "../common.h"
#include "../worker.h"
#include "../job_event.h"
#include "../priority_queue.h"
#include <libconfig.h>

#define MAX_SERVERS 64

#define DEFAULT_WORKERS 10
#define DEFAULT_MULTIACCEPT 1
#define DEFAULT_WORKER_STACK_SIZE 256

typedef struct s_object_pool_conf_array
{
	object_pool_conf el[MAX_POOLS];
	int count;

} object_pool_conf_array;


typedef struct s_mashup_server_endpoint
{
	int listen_port;
	char listen_ip[24];
	int tcp_backlog;
	int multiaccept;
	socket_t server_socket; // socket servidor.
	job_event server_event_config;// evento de configuracion para el server.

} mashup_server_endpoint_t;

typedef struct s_mashup_server_endpoint_array
{
	mashup_server_endpoint_t el[MAX_SERVERS];
	int count;

} mashup_server_endpoint_array;

// humilde archivo de configuracion :)
typedef struct s_mashup_server_core_config_t
{
	int workers;
	size_t worker_stack_size;
	priority_queue_conf_t q_conf;
	object_pool_conf_array pool_conf;
	mashup_server_endpoint_array server_configs;

} mashup_server_core_config_t;

int conf_file_parse(mashup_server_core_config_t *cf, const char *filename);

#endif /* MASHUP_SERVER_CONF_FILE_H_INCLUDED */
